package com.yiyang.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yiyang.domain.Result;
import com.yiyang.domain.po.Bed;
import com.yiyang.service.BedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/bed")
public class BedController {

    @Autowired
    private BedService bedService;

    @GetMapping("/findBed")
    public Result<List<Bed>> findBed(Integer roomNo){
        // 组装查询条件
        QueryWrapper<Bed> qw = new QueryWrapper<>();
        qw.eq("room_no",roomNo);
        qw.eq("status","1");

        List<Bed> bedList = bedService.list(qw);

        return Result.success(bedList);
    }
}
